
#include <biosignal.h>

#include <iostream>

using namespace std;
using namespace biosignal;

class TimeSystemTest {
public:
	void run() {

		TimePoint d1(2009, 9, 04);
		cout << " d1 : " << d1 << endl;

		TimePoint d2(2009, 9, 05);
		cout << " d2 : " << d2 << endl;

		TimeOffset ndiff = d1-d2;
		cout << "ndiff : " << ndiff << "  is_negative :  " << ndiff.is_negative() << endl;

		TimeOffset diff = d2-d1;
		cout << "diff : " << diff << "  is_negative :  " << diff.is_negative() << endl;

		cout << " d1 + diff : " << d1+diff << endl;
		cout << " d1 + diff + 10.3 sec: " << d1+diff + TimeOffset::Seconds(10.3) << endl;
		cout << " d1 + diff + 10.1 sec + + 10.1 sec : " << d1+diff + TimeOffset::Seconds(10.1) + TimeOffset::Seconds(10.1) << endl;

		TimePoint start(2009, 9, 04, 13, 25, 10);
		cout << " start : " << start << endl;

		TimePoint end(2009, 9, 05, 13, 50, 33);
		cout << " end : " << end << endl;

		TimePoint before(2009, 9, 04, 13, 25, 9);
		cout << " before : " << before << endl;

		TimePoint after(2009, 9, 05, 13, 50, 34);
		cout << " after : " << after << endl;
		TimePeriod tp(d1,d2);
		cout << " tp : " << tp << endl;

		int day=2, month=10, year=2009, hour=14, minute=27, second=0;

		TimePoint datetime(year, month, day, hour, minute, second);
		TimeOffset offset = TimeOffset::Seconds(81);
		cout << " offset " << offset << endl;
		TimePeriod timeperiod(datetime, datetime+offset);
		cout << " timeperiod : " << timeperiod << endl;


		TimeOffset subseconds = TimeOffset::Seconds(0.75);
		cout << " subseconds : " << subseconds << endl;
		double sec = subseconds.total_seconds();
		cout << " total seconds : " << sec;

	}
};


int main() {
	TimeSystemTest test;
	test.run();
}
